﻿<UserControl x:Class="HelloWorld.View.OrderScreenView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignHeight="455" d:DesignWidth="847" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" xmlns:tk="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit" d:DataContext="{Binding Source={StaticResource ViewModelLocator}, Path=OrderScreenViewModel}">

    <tk:BusyIndicator IsBusy="{Binding IsBusy}">
        <tk:BusyIndicator.BusyContent>
            <TextBlock Text="LOADING..." />
        </tk:BusyIndicator.BusyContent>

        <Grid x:Name="LayoutRoot" Background="White">
            <Grid.RowDefinitions>
                <RowDefinition Height="32" />
                <RowDefinition Height="0.548*"/>
                <RowDefinition Height="0.452*" />
                <RowDefinition Height="40" />
            </Grid.RowDefinitions>
            <sdk:DataGrid AutoGenerateColumns="False" Name="Customers" ItemsSource="{Binding Customers}" SelectedItem="{Binding CurrentCustomer, Mode=TwoWay}" Grid.Row="1">
                <sdk:DataGrid.Columns>
                    <sdk:DataGridTextColumn Header="Company" Binding="{Binding CompanyName}" Width="Auto"/>
                    <sdk:DataGridTextColumn Header="Contact Name" Binding="{Binding ContactName}" Width="Auto"/>
                    <sdk:DataGridTextColumn Binding="{Binding Address}" Header="Address" />
                    <sdk:DataGridTextColumn Binding="{Binding City}" Header="City" Width="Auto" />
                    <sdk:DataGridTextColumn Binding="{Binding Region}" Header="State/Region" />
                    <sdk:DataGridTextColumn Binding="{Binding PostalCode}" Header="Postal Code" />
                    <sdk:DataGridTextColumn Binding="{Binding Phone}" Header="Phone" />
                </sdk:DataGrid.Columns>
            </sdk:DataGrid>
            <sdk:DataGrid AutoGenerateColumns="False" Grid.Row="2" Name="Orders" ItemsSource="{Binding CurrentCustomer.Orders}" SelectedItem="{Binding CurrentOrder, Mode=TwoWay}" >
                <sdk:DataGrid.Columns>
                    <sdk:DataGridTextColumn Binding="{Binding OrderDate}" Header="Order Date"/>
                    <sdk:DataGridTextColumn Binding="{Binding RequiredDate}" Header="Required Date"/>
                    <sdk:DataGridTextColumn Binding="{Binding ShipName}" Header="Ship To"/>
                    <sdk:DataGridTextColumn Binding="{Binding ShipAddress}" Header="Shipping Address"/>
                    <sdk:DataGridTextColumn Binding="{Binding ShipCity}" Header="City"/>
                    <sdk:DataGridTextColumn Binding="{Binding Employee.FirstName}" Header="Firstname"/>
                    <sdk:DataGridTextColumn Binding="{Binding Employee.LastName}" Header="Lastname"/>
                </sdk:DataGrid.Columns>
            </sdk:DataGrid>
            <Button x:Name="ShowOrderDetail" Content="Edit Order" Grid.Row="3" Height="23" HorizontalAlignment="Left" Margin="6,6,0,0" VerticalAlignment="Top" Width="75" />
            <TextBlock HorizontalAlignment="Right" Margin="0,8,8,9" TextWrapping="Wrap" x:Name="CurrentUser" Width="320" VerticalAlignment="Stretch" TextAlignment="Right" Text="{Binding CurrentUser, Mode=OneWay}" />
        </Grid>
    </tk:BusyIndicator>
</UserControl>